Integrand size = 21, antiderivative size = 94 \[ \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {a \left (a^2-b^2\right ) x}{2 \left (a^2+b^2\right )^2}+\frac {a^2 b \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^2 d}-\frac {\cos ^2(c+d x) (b+a \tan (c+d x))}{2 \left (a^2+b^2\right ) d} \]
1/2*a*(a^2-b^2)*x/(a^2+b^2)^2+a^2*b*ln(a*cos(d*x+c)+b*sin(d*x+c))/(a^2+b^2 )^2/d-1/2*cos(d*x+c)^2*(b+a*tan(d*x+c))/(a^2+b^2)/d
Time = 0.87 (sec) , antiderivative size = 170, normalized size of antiderivative = 1.81 \[ \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx=-\frac {2 a b \left (a^2+b^2\right ) \arctan (\tan (c+d x))+2 b^2 \left (a^2+b^2\right ) \cos ^2(c+d x)+a \left (2 a \left (\left (b^2+a \sqrt {-b^2}\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-2 b^2 \log (a+b \tan (c+d x))+\left (b^2-a \sqrt {-b^2}\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )\right )+b \left (a^2+b^2\right ) \sin (2 (c+d x))\right )}{4 b \left (a^2+b^2\right )^2 d} \]
-1/4*(2*a*b*(a^2 + b^2)*ArcTan[Tan[c + d*x]] + 2*b^2*(a^2 + b^2)*Cos[c + d *x]^2 + a*(2*a*((b^2 + a*Sqrt[-b^2])*Log[Sqrt[-b^2] - b*Tan[c + d*x]] - 2* b^2*Log[a + b*Tan[c + d*x]] + (b^2 - a*Sqrt[-b^2])*Log[Sqrt[-b^2] + b*Tan[ c + d*x]]) + b*(a^2 + b^2)*Sin[2*(c + d*x)]))/(b*(a^2 + b^2)^2*d)
Time = 0.37 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.55, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 3999, 601, 25, 27, 657, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sin (c+d x)^2}{a+b \tan (c+d x)}dx\) |
\(\Big \downarrow \) 3999 |
\(\displaystyle \frac {b \int \frac {b^2 \tan ^2(c+d x)}{(a+b \tan (c+d x)) \left (\tan ^2(c+d x) b^2+b^2\right )^2}d(b \tan (c+d x))}{d}\) |
\(\Big \downarrow \) 601 |
\(\displaystyle \frac {b \left (-\frac {\int -\frac {a b^2 (a-b \tan (c+d x))}{\left (a^2+b^2\right ) (a+b \tan (c+d x)) \left (\tan ^2(c+d x) b^2+b^2\right )}d(b \tan (c+d x))}{2 b^2}-\frac {a b \tan (c+d x)+b^2}{2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {b \left (\frac {\int \frac {a b^2 (a-b \tan (c+d x))}{\left (a^2+b^2\right ) (a+b \tan (c+d x)) \left (\tan ^2(c+d x) b^2+b^2\right )}d(b \tan (c+d x))}{2 b^2}-\frac {a b \tan (c+d x)+b^2}{2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {b \left (\frac {a \int \frac {a-b \tan (c+d x)}{(a+b \tan (c+d x)) \left (\tan ^2(c+d x) b^2+b^2\right )}d(b \tan (c+d x))}{2 \left (a^2+b^2\right )}-\frac {a b \tan (c+d x)+b^2}{2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\) |
\(\Big \downarrow \) 657 |
\(\displaystyle \frac {b \left (\frac {a \int \left (\frac {2 a}{\left (a^2+b^2\right ) (a+b \tan (c+d x))}+\frac {a^2-2 b \tan (c+d x) a-b^2}{\left (a^2+b^2\right ) \left (\tan ^2(c+d x) b^2+b^2\right )}\right )d(b \tan (c+d x))}{2 \left (a^2+b^2\right )}-\frac {a b \tan (c+d x)+b^2}{2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {b \left (\frac {a \left (\frac {\left (a^2-b^2\right ) \arctan (\tan (c+d x))}{b \left (a^2+b^2\right )}-\frac {a \log \left (b^2 \tan ^2(c+d x)+b^2\right )}{a^2+b^2}+\frac {2 a \log (a+b \tan (c+d x))}{a^2+b^2}\right )}{2 \left (a^2+b^2\right )}-\frac {a b \tan (c+d x)+b^2}{2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\) |
(b*((a*(((a^2 - b^2)*ArcTan[Tan[c + d*x]])/(b*(a^2 + b^2)) + (2*a*Log[a + b*Tan[c + d*x]])/(a^2 + b^2) - (a*Log[b^2 + b^2*Tan[c + d*x]^2])/(a^2 + b^ 2)))/(2*(a^2 + b^2)) - (b^2 + a*b*Tan[c + d*x])/(2*(a^2 + b^2)*(b^2 + b^2* Tan[c + d*x]^2))))/d
3.1.54.3.1 Defintions of rubi rules used
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[(x_)^(m_)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbo l] :> With[{Qx = PolynomialQuotient[x^m*(c + d*x)^n, a + b*x^2, x], e = Coe ff[PolynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 0], f = Coeff[Pol ynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 1]}, Simp[(a*f - b*e*x) *((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Simp[1/(2*a*(p + 1)) Int[(c + d*x)^n*(a + b*x^2)^(p + 1)*ExpandToSum[(2*a*(p + 1)*Qx)/(c + d*x)^n + (e* (2*p + 3))/(c + d*x)^n, x], x], x]] /; FreeQ[{a, b, c, d}, x] && IGtQ[m, 1] && LtQ[p, -1] && ILtQ[n, 0] && NeQ[b*c^2 + a*d^2, 0]
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_) + (c_.)*( x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g*x)^n/(a + c*x^ 2)), x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IntegersQ[n]
Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_ ), x_Symbol] :> Simp[b/f Subst[Int[x^m*((a + x)^n/(b^2 + x^2)^(m/2 + 1)), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[m/2]
Time = 1.15 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.30
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-\frac {1}{2} a^{3}-\frac {1}{2} a \,b^{2}\right ) \tan \left (d x +c \right )-\frac {a^{2} b}{2}-\frac {b^{3}}{2}}{1+\tan ^{2}\left (d x +c \right )}+\frac {a \left (-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{2}}{\left (a^{2}+b^{2}\right )^{2}}+\frac {a^{2} b \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(122\) |
default | \(\frac {\frac {\frac {\left (-\frac {1}{2} a^{3}-\frac {1}{2} a \,b^{2}\right ) \tan \left (d x +c \right )-\frac {a^{2} b}{2}-\frac {b^{3}}{2}}{1+\tan ^{2}\left (d x +c \right )}+\frac {a \left (-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{2}}{\left (a^{2}+b^{2}\right )^{2}}+\frac {a^{2} b \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(122\) |
risch | \(-\frac {a x}{2 \left (2 i a b -a^{2}+b^{2}\right )}+\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{8 \left (-i b +a \right ) d}-\frac {i {\mathrm e}^{-2 i \left (d x +c \right )}}{8 \left (i b +a \right ) d}-\frac {2 i a^{2} b x}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {2 i a^{2} b c}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {a^{2} b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(175\) |
1/d*(1/(a^2+b^2)^2*(((-1/2*a^3-1/2*a*b^2)*tan(d*x+c)-1/2*a^2*b-1/2*b^3)/(1 +tan(d*x+c)^2)+1/2*a*(-a*b*ln(1+tan(d*x+c)^2)+(a^2-b^2)*arctan(tan(d*x+c)) ))+a^2*b/(a^2+b^2)^2*ln(a+b*tan(d*x+c)))
Time = 0.27 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.30 \[ \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {a^{2} b \log \left (2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}\right ) + {\left (a^{3} - a b^{2}\right )} d x - {\left (a^{2} b + b^{3}\right )} \cos \left (d x + c\right )^{2} - {\left (a^{3} + a b^{2}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} d} \]
1/2*(a^2*b*log(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^ 2 + b^2) + (a^3 - a*b^2)*d*x - (a^2*b + b^3)*cos(d*x + c)^2 - (a^3 + a*b^2 )*cos(d*x + c)*sin(d*x + c))/((a^4 + 2*a^2*b^2 + b^4)*d)
\[ \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\int \frac {\sin ^{2}{\left (c + d x \right )}}{a + b \tan {\left (c + d x \right )}}\, dx \]
Time = 0.30 (sec) , antiderivative size = 144, normalized size of antiderivative = 1.53 \[ \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\frac {2 \, a^{2} b \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {a^{2} b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {{\left (a^{3} - a b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {a \tan \left (d x + c\right ) + b}{{\left (a^{2} + b^{2}\right )} \tan \left (d x + c\right )^{2} + a^{2} + b^{2}}}{2 \, d} \]
1/2*(2*a^2*b*log(b*tan(d*x + c) + a)/(a^4 + 2*a^2*b^2 + b^4) - a^2*b*log(t an(d*x + c)^2 + 1)/(a^4 + 2*a^2*b^2 + b^4) + (a^3 - a*b^2)*(d*x + c)/(a^4 + 2*a^2*b^2 + b^4) - (a*tan(d*x + c) + b)/((a^2 + b^2)*tan(d*x + c)^2 + a^ 2 + b^2))/d
Leaf count of result is larger than twice the leaf count of optimal. 184 vs. \(2 (90) = 180\).
Time = 0.39 (sec) , antiderivative size = 184, normalized size of antiderivative = 1.96 \[ \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\frac {2 \, a^{2} b^{2} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{4} b + 2 \, a^{2} b^{3} + b^{5}} - \frac {a^{2} b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {{\left (a^{3} - a b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {a^{2} b \tan \left (d x + c\right )^{2} - a^{3} \tan \left (d x + c\right ) - a b^{2} \tan \left (d x + c\right ) - b^{3}}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} {\left (\tan \left (d x + c\right )^{2} + 1\right )}}}{2 \, d} \]
1/2*(2*a^2*b^2*log(abs(b*tan(d*x + c) + a))/(a^4*b + 2*a^2*b^3 + b^5) - a^ 2*b*log(tan(d*x + c)^2 + 1)/(a^4 + 2*a^2*b^2 + b^4) + (a^3 - a*b^2)*(d*x + c)/(a^4 + 2*a^2*b^2 + b^4) + (a^2*b*tan(d*x + c)^2 - a^3*tan(d*x + c) - a *b^2*tan(d*x + c) - b^3)/((a^4 + 2*a^2*b^2 + b^4)*(tan(d*x + c)^2 + 1)))/d
Time = 5.01 (sec) , antiderivative size = 147, normalized size of antiderivative = 1.56 \[ \int \frac {\sin ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {a^2\,b\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{d\,{\left (a^2+b^2\right )}^2}-\frac {a\,\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}{4\,d\,\left (-a^2\,1{}\mathrm {i}+2\,a\,b+b^2\,1{}\mathrm {i}\right )}-\frac {{\cos \left (c+d\,x\right )}^2\,\left (\frac {b}{2\,\left (a^2+b^2\right )}+\frac {a\,\mathrm {tan}\left (c+d\,x\right )}{2\,\left (a^2+b^2\right )}\right )}{d}-\frac {a\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{4\,d\,\left (-a^2+a\,b\,2{}\mathrm {i}+b^2\right )} \]